{% include 'JDXJ/JDXJ_index.html' %}

<div class="am-cf admin-main">
  {% include 'sidebar.html' %}
  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">故障信息</strong></div>
      </div>

      <div class="am-g">

        <div class="am-u-sm-12">
          <div class="am-u-sm-12 am-u-md-6">
            <div class="am-btn-toolbar">
              <div class="am-btn-group am-btn-group-xs">
                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" style="margin-right: 5px" onclick=""></span>导出</button>
                <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary" style="margin-right: 5px" onclick=""></span>打印</button>
                <strong>检查类型：</strong>
                <select id="check_type" onchange="type_change()">
                  <option value="1">日常巡查</option>
                  <option value="2">经常检查</option>
                  <option value="3">定期巡查</option>
                </select>

              </div>
            </div>
          </div>
          <table id="grid" class="am-table am-table-striped am-table-hover table-main am-table-compact am-text-nowrap" width="100%">
            <thead>
              <tr>
                <th class="table-title">序号</th>
                <th class="table-title">系统分类</th>
                <th class="table-title">任务编号</th>
                <th class="table-title">设备名称</th>
                <th class="table-title">检查项目</th>
                <th class="table-title">检查内容</th>
                <th class="table-title">备注</th>
                <th class="table-title">录入日期</th>
                <th class="table-set">操作</th>
              </tr>
            </thead>
            <tbody></tbody>
          </table>
        </div>
      </div>
    </div>
    <!-- content end -->
  </div>
</div>
{% include 'footer.html' %}
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/static/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="/static/assets/js/amazeui.min.js"></script>
<script src="/static/assets/js/amazeui.tree.js"></script>
<script type="text/javascript" src="/static/assets/js//layer.js"></script>
<script src="/static/assets/datatables/amazeui.datatables.min.js"></script>
<script src="/static/assets/dialog/amazeui.dialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/assets/css/amazeui.tree.css" />
<script src="/static/assets/js/app.js"></script>
<script type="text/javascript">
  $("#collapse-nav8").addClass("am-in");
  $("#jdxj").removeClass("am-collapsed");
  $("#jdxj").css("color", "#3399CC");
  $("#jdxjgzxx").css("color", "#3399CC");
  
  // console.log(check_type)


// App.globalAjax("post", "/Order/DeleteOrder", data, function (result) {
//             App.globalAjax("get", "/Order/MyJsonList", {}, function (result) {
//                 var html = template('Orders-template', result);
//                 if ($('#datatable1').hasClass('dataTable')) {
//                     dttable = $('#datatable1').dataTable();
//                     dttable.fnClearTable(); //清空一下table
//                     dttable.fnDestroy(); //还原初始化了的datatable
//                 }
//                 $("#datatable1").find("tbody").html(html);
//                 $('#datatable1').dataTable();
//             });
//         });


// var dttable;
// App.globalAjax("get", "/Order/MyJsonList", {}, function (result) {
// 　 var html = template('Orders-template', result);
//    $("#datatable1").find("tbody").html(html);
//    dttable = $('#datatable1').dataTable({
//         "sPaginationType": "bs_full"
//    });
// });

  $(document).ready(function(){
    type_change();
  })


  function type_change(){
    var check_type = $("#check_type option:selected").val();
    if ($('#grid').hasClass('dataTable')) {
      dttable = $('#grid').dataTable();
      dttable.fnClearTable(); //清空一下table
      dttable.fnDestroy(); //还原初始化了的datatable
    }
    var t = $('#grid').DataTable({
    //配置DataTables默认参数

    bInfo: true, //页脚信息
    responsive: true,
    searching: true,
    lengthChange: false,
    paging: true,
    aLengthMenu: [[10],[10]],
    ajax: {

      url: "/JDXJ_GZXX_DATA/?check_type="+check_type
    },

    //每页显示五条数据
    //pageLength: 'all',
    columns: [{
        data: null,
        bSortable: false,
        targets: 0,
        //width : "30px",  
        render: function(data, type, row, meta) {
          // 显示行号  
          var startIndex = meta.settings._iDisplayStart;
          return startIndex + meta.row + 1;
        }
      },
      {
        "data": "sys_name"
      },
      {
        "data": "task_number"
      },
      {
        "data": "equipment_name"
      },
      {
        "data": "check_item"
      },
      {
        "data": "check_content"
      },
      {
        "data": "check_remark"
      },
      {
        "data": "datetime"
      }
      ,
      {
        "data": "checked_id"
      }
    ],
    "columnDefs": [
      // "visible": false,
      //"targets": 0

      {
        type: 'chinese-string',
        targets: '_all'
      } //中文排序
      ,

      {
        "render": function(data, type, row, meta) {
          return '<div class="am-btn-toolbar"><div class="am-btn-group am-btn-group-xs"><button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="checked_details(' + row.checked_id + ')"><span class="am-icon-pencil-square-o"></span>详情</button></div></div>'
        },
        //指定是第二列
        "targets": 8
      }
    ],

  });
  }


  function checked_details(checked_id) {
    window.location.href="/JDXJ_GZXX_XQ/?checked_id="+checked_id
    // popup("新增部门", "/XTGL_BMGL_ADD/")
  }

  // function department_modify(organize_id) {
  //   popup("修改部门", "/XTGL_BMGL_MODIFY/?organizeID=" + organize_id + "")
  // }

  // function department_delect(organize_id,name) {
  //   AMUI.dialog.confirm({
  //     title: '删除确认',
  //     content: '您确认删除['+name+'?]',
  //     onConfirm: function() {
  //       //console.log('onConfirm,save ' + organize_id);
  //       $.ajax({
  //         "url": "/XTGL_BMGL_3/?organizeID="+ organize_id +"",
  //         "datatype": "json",
  //         "type": "get",
  //         "async": "false"
  //       }).success(function(data) {
  //         if(data.status == 1) {
  //           window.location.reload();
  //         } else {
  //           AlertMSG(data.message)
  //         }
  //       }).error(function(data) {
  //         AlertMSG("删除失败！")
  //       });
  //     },
  //     onCancel: function() {
  //       console.log('onCancel')
  //     }
  //   });
  // };

  /*

    function department_delect(organize_id){
      $.ajax({
        "url":"/XTGL_BMGL_3/?organizeID="+organize_id+"",
        "datatype":"json",
        "type":"post",
        "async":"false"
        }).success(function(data){
          if (data.status == 1) {
            window.location.reload();
          } else {
            AlertMSG(data.message)
          }
        }).error(function(data){
          AlertMSG("删除失败！")
        });
    }
  */
  function popup(title, url) {
    var index = layer.open({
      type: 2,
      title: title,
      content: url,
      area: ['700px', '500px'],

    });

    //铺满界面
    //layer.full(index);
  }
  var AlertMSG = function(msg) {
    AMUI.dialog.alert({
      title: '错误提示',
      content: msg,
      onConfirm: function() {
        console.log('close');
      }
    });
  }
</script>
</body>

</html>